﻿@model ProductDetailsModel.ProductPriceModel
@using SDF.Core
@using SDF.Core.Domain.Tax
@using SDF.Core.Infrastructure
@using SDF.Web.Models.Catalog;
@if (!Model.CustomerEntersPrice)
{
    <div class="prices" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        @if (Model.CallForPrice)
        {
        @*call for price*@
            <div class="product-price call-for-price">
                <span>@T("Products.CallForPrice")</span>
            </div>
        }
        else
        {
            if (Model.IsRental)
            {
                <div class="rental-price">
                    <label>@T("Products.Price.RentalPrice"):</label>
                    <span>@Model.RentalPrice</span>
                </div>
            }
            if (!String.IsNullOrWhiteSpace(Model.OldPrice))
            {
            @*old price*@
                <div class="old-product-price">
                    <label>@T("Products.Price.OldPrice"):</label>
                    <span>@Model.OldPrice</span>
                </div>
            }
            <div class="@if (String.IsNullOrWhiteSpace(Model.PriceWithDiscount))
                        {
                            <text>product-price</text>
                        }
                        else
                        {
                            <text>non-discounted-price</text>
                        }">
                @if (!String.IsNullOrWhiteSpace(Model.OldPrice) || !String.IsNullOrWhiteSpace(Model.PriceWithDiscount))
                {
                    @*display "Price:" label if we have old price or discounted one*@
                    <label>@T("Products.Price"):</label>
                }
                @*render price*@<span @if (String.IsNullOrWhiteSpace(Model.PriceWithDiscount))
                                      {
                                          <text> itemprop="price" content="@Model.PriceValue.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)" class="price-value-@(Model.ProductId)" </text>
                                      }>
                    @Html.Raw(Model.Price)
                </span>
            </div>
            if (!String.IsNullOrWhiteSpace(Model.PriceWithDiscount))
            {
            @*discounted price*@
                <div class="product-price discounted-price">
                    <label>@T("Products.Price.WithDiscount"):</label>
                    <span itemprop="price" content="@Model.PriceValue.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)" class="price-value-@(Model.ProductId)">
                        @Html.Raw(Model.PriceWithDiscount)
                    </span>
                </div>
            }
            if (!String.IsNullOrEmpty(Model.BasePricePAngV))
            {
                <div class="base-price-pangv">
                    @Model.BasePricePAngV
                </div>
            }
            if (Model.DisplayTaxShippingInfo)
            {
                var inclTax = EngineContext.Current.Resolve<IWorkContext>().TaxDisplayType == TaxDisplayType.IncludingTax;
                //tax info is already included in the price (incl/excl tax). that's why we display only shipping info here
                //of course, you can modify appropriate locales to include VAT info there
                <div class="tax-shipping-info">
                    @T(inclTax ? "Products.Price.TaxShipping.InclTax" : "Products.Price.TaxShipping.ExclTax", Url.RouteUrl("Topic", new {SeName = Html.GetTopicSeName("shippinginfo")}))
                </div>
            }
            if (!String.IsNullOrEmpty(Model.CurrencyCode))
            {
                <meta itemprop="priceCurrency" content="@Model.CurrencyCode"/>
            }
        }
    </div>
}
